<?php 

	include "include.php";

	$isSecureAccess = SecurityManager::getUser() != null; 	
	
	if( $isSecureAccess ) {
		$planet = Scope::loadSessionObject("PLANET");
		if( $planet == null ) {
			$planet = new PlanetModel();
		}
?>
<div id="cadastro">
	<h3>Cadastro de Planeta</h3>
	<form method="POST" action="?option=planetsave">
		<input type="hidden" name="roundId" value="<?php echo $planet->getRoundId(); ?>">
		<input type="hidden" name="userId" value="<?php echo $planet->getUserId(); ?>">
		<table width="460px" cellspacing="0">
			<tr>
				<td class="label">Coordenada</td>
				<td class="input">
					<input type="text" name="sector" size="1" value="<?php echo $planet->getSector(); ?>">:
					<input type="text" name="galaxia" size="1" value="<?php echo $planet->getGalaxia(); ?>">:
					<input type="text" name="slot" size="1" value="<?php echo $planet->getSlot(); ?>">
				</td>
			</tr>
			<tr>
				<td class="label">Nome</td>
				<td class="input"><input type="text" class="text" id="name" name="name" tabindex="1" value="<?php echo $planet->getName(); ?>"></td>
			</tr>
			<tr>
				<td colspan="2" class="input">
					<button type="reset">Reset</button>&nbsp;<button type="submit">Enviar</button>
				</td>
			</tr>
		</table>
	</form>	
</div>

<?php 
	} else {
		MessageManager::setError("Voc&ecirc; n&atilde;o tem permiss&atilde;o para acessar esta p&aacute;gina");
		Util::includeFile("error.php",true);		
	}
?>